<template>
  <div>
    <a-modal
      title="详情"
      :visible="visible"
      :width="1000"
      :height="1000"
      :confirmLoading="confirmLoading"
       @cancel="() => { $emit('cancel') }"
       @ok="() => { $emit('submit') }"
    >
      <a-tabs default-active-key="1" @change="callback">
            <a-tab-pane v-for="item in data" :key="item.k" :lazy="true" :tab="item.k" :name="item.k">
              <Java :value="item.v" height="600px"/>
            </a-tab-pane>
      </a-tabs>
    </a-modal>
  </div>
</template>

<script>
import Java from './CodeMirrorjava'
export default {
  name: 'Preview',
  components: { Java },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    confirmLoading: {
      type: Boolean,
      default: false
    },
    data: []
  },
  data () {
    return {
      labelCol: {
        xs: { span: 8 },
        sm: { span: 12 }
      },
      wrapperCol: {
        xs: { span: 8 },
        sm: { span: 12 }
      }
    }
  },
  beforeCreate () {
    this.form = this.$form.createForm(this, { name: 'post_from2' })
  },
  methods: {
    showModal2 (row) {
      this.visible2 = true
    },
      // fetchPreview(id).then(res => {
      //   this.refreshTable()
      // })
    handleCancel () {
      this.visible2 = false
      // fetchCode(id).then(res => {
      //   this.refreshTable()
      // })
    },
    handleOk () {
      debugger
      this.visible2 = false
    },
    callback () {
    }
  }
}
</script>
